package chap9;
//************************************************************************
//  SchoolBook2.java                Author:GK
//
//  表示本书读者的年龄（4-16岁）。
//************************************************************************

public class SchoolBook2 extends Book2{

    private int age;

    public SchoolBook2(int numPages, int a) {
        super(numPages);
        age = a;
    }

    //--------------------------------------------------------------------
    //  提供level方法，返回以下字符串。
    //--------------------------------------------------------------------
    public String level() {
        if (age >= 4 && age <= 6)
            return "Pre-school";
        else
            if (age <= 9)
            return "Early";
        else
            if (age <= 12)
            return "Middle";
        else
            return "Upper";
    }

}
